<template>
	<view class="pay_order">
	<view class="pat_top">
		<view class="pay_title">
			付款金额
		</view>
		<view class="pay_number">
			<span>￥</span>{{price}}
		</view>
	</view>
		<view class="pay_content">
			<view class="one">
			<tm-icons :size="30" name="icon-weixinzhifu" color='green'></tm-icons>	微信
			</view>
			<view class="two">
				<tm-checkbox :disabled='checked2' v-model="checked"></tm-checkbox>
			</view>
		</view>
		<view class="pay_content">
			<view class="one">
			<tm-icons :size="30" name="icon-transanction" ></tm-icons>余额支付
			</view>
			<view class="two">
				<tm-checkbox :disabled='checked' v-model="checked2"></tm-checkbox>
			</view>
		</view>
		<view class="pay_btn">
			
		<tm-button size='n'  @click='payorder()' :block='true' :width='550' :font-size='28'>立即支付</tm-button>
		</view>
		<view class="pay_bottom" @click="nopay">
			暂不支付
		</view>
	</view>
</template>

<script>
	export default {
		onLoad(ref) {
			this.id= ref.orderid
			this.price = ref.price
		},
		data() {
			return {
				checked:true,
				checked2:false,
				id:'',
				price:''
			}
		},
		methods: {
			async payorder(){
				const Rres = await  this.$wxRequest({
					url:'/wx/pay_order',
					method:'POST',
					data:{
						AO010:this.id,
						}
				})
				console.log(Rres)
				if(Rres.data.code == 200){
				uni.switchTab({
					url:`/pages/order/order?id=${Rres.data.list.AO001}&avtiveid=${0}`
				})
				}
			},
			async nopay(){
				const Rres = await  this.$wxRequest({
					url:'/wx/cancel_pay_order',
					method:'POST',
					data:{
						AO010:this.id,
					}
				})
				uni.switchTab({
					url:`/pages/order/order?id=${this.id}&avtiveid=${1}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.pay_order{
	.pat_top{
		box-sizing: border-box;
		margin: 60rpx 0;
		.pay_title{
			text-align: center;
			font-size: 24rpx;
			color: #8c8c8c;
		}
		.pay_number{
			text-align: center;
			font-weight: 600;
			font-size: 40rpx;
			span{
				font-size: 28rpx;
			}
		}
	}

	.pay_content{
		background-color: #ffffff;
		width: 95%;
		margin: auto;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 20rpx;
		.one{
			
		}
		.two{
			
		}
	}
	.pay_btn{
		text-align: center;
	}
	.pay_bottom{
		font-size: 28rpx;
		color: #8c8c8c;
		// text-align: center;
		position: fixed;
		bottom: 40rpx;
		margin: auto;
		left: 50%;
		transform: translateX(-50%);
	}
}
</style>
